Beyond LEX and YACC: How to Generate the Whole Compiler
نویسنده
چکیده
LEX and YACC (or FLEX and BISON) allow a compiler writer to generate scanners and parsers from simple speciications, but scanning and parsing account for only about 15% of a typical compiler. Tool support is now available for the other 85%. This paper explains how new and existing tools have been combined in a domain-speciic programming environment that reduces compiler development eeort to about one third of that needed with LEX and YACC alone. Measurements show that the resulting compiler's performance is within a few percent of a carefully hand-crafted version.
منابع مشابه
An educational tool for teaching compiler construction
Compiler construction is a well-developed discipline since there is a long tradition of producing compilers supported by practical underlying theory and a large selection of textbooks. In the compiler construction course, students learn how to write a compiler by hand and how to generate a compiler using tools like lex and yacc. However, these tools usually have little or no didactical value. I...
متن کاملHygienic Source-Code Generation Using Functors
Existing source-code-generating tools such as Lex and Yacc suffer from practical inconveniences because they use disembodied code to implement actions. To prevent this problem, such tools could generate closed functors that are then instantiated by the programmer with appropriate action code. This results in all code being type checked in its appropriate context, and it assists the type checker...
متن کاملLex ! A Lexical Analyzer Generator
Lex helps write programs whose control flow is directed by instances of regular expressions in the input stream. It is well suited for editor-script type transformations and for segmenting input in preparation for a parsing routine. Lex source is a table of regular expressions and corresponding program fragments. The table is translated to a program which reads an input stream, copying it to an...
متن کاملReinventing the Wheel Or Not Yet Another Compiler Compiler Compiler
This paper discusses a tool developed for generating code generators. The first author, dismayed with the clumsiness of lex, yacc, JLex, and Java Cup, proposes a new tool that serves to augment the above tools, discusses challenges met during the first generation of said tool, and lays out plans for future revisions.
متن کاملThe PRECC Compiler Compiler
PRECC is a UNIX utility that has been designed to extend the capabilities of the familiar LEX and YACC front-end design and implementation tools. The utility is a compiler-compiler that takes unlimited lookahead and backtracking, the extended BNF notation, and parametrized grammars with (higher order) meta-parameters to the world of C programming. The generated code is standard ANSI C and is `p...
متن کامل